package com.joker.demo.core.domain.dto;


import java.io.Serializable;

/**
 * 基础查询DTO
 * @author : feixiang.li
 * @since : 2025-07-25 18:10
 */
public class BaseQueryDTO implements Serializable {

    /**
     * 每页数量
     */
    private Integer pageSize;


    /**
     * 当前页码
     */
    private Integer pageNum;

    /**
     * 上一个批次的id
     */
    private Long lastTableSourceId;


    public Integer getStart() {
        if (this.pageNum == null || this.pageNum < 1) {
            this.pageNum = 1;
        }
        if (this.pageSize == null || this.pageSize == 0) {
            this.pageSize = 20;
        }
        return (this.pageNum - 1) * this.pageSize;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Long getLastTableSourceId() {
        return lastTableSourceId;
    }

    public void setLastTableSourceId(Long lastTableSourceId) {
        this.lastTableSourceId = lastTableSourceId;
    }

    @Override
    public String toString() {
        return "BaseQueryDTO{" +
                "pageSize=" + pageSize +
                ", pageNum=" + pageNum +
                ", lastTableSourceId=" + lastTableSourceId +
                '}';
    }
}
